import request from '@/config/axios'

// 仪器型号查看 VO
export interface DeviceBaseVO {
  id: number // 主键
  deviceModeCode: string // 仪器型号编码
  type: string // 仪器类型
  mode: string // 仪器型号
  factoryCode: string // 厂家code
  remark: string // 备注
  state: boolean // 状态(0:禁用，1:启用)
  protocol: string // 协议
  port: string // 端口号
  ip: string // IP
  value: string
  label: string
  isLeaf: string
}

// 仪器型号查看 API
export const DeviceBaseApi = {
  // 查询仪器型号查看分页
  getDeviceBasePage: async (params: any) => {
    return await request.get({ url: `/base/device-base/page`, params })
  },

  // 查询仪器型号查看详情
  getDeviceBase: async (id: number) => {
    return await request.get({ url: `/base/device-base/get?id=` + id })
  },

  // 新增仪器型号查看
  createDeviceBase: async (data: DeviceBaseVO) => {
    return await request.post({ url: `/base/device-base/create`, data })
  },

  // 修改仪器型号查看
  updateDeviceBase: async (data: DeviceBaseVO) => {
    return await request.put({ url: `/base/device-base/update`, data })
  },

  // 删除仪器型号查看
  deleteDeviceBase: async (id: number) => {
    return await request.delete({ url: `/base/device-base/delete?id=` + id })
  },

  // 导出仪器型号查看 Excel
  exportDeviceBase: async (params) => {
    return await request.download({ url: `/base/device-base/export-excel`, params })
  },
  //获取仪器型号信息精简信息列表
  getDeviceList: async (params: any) => {
    return await request.get({ url: `/base/device-base/getlist` , params })
  },


  // 下载用户导入模板
  importTemplate: async () => {
    return await request.download({ url: '/base/device-base/downTemplate' })
  },
  //导入excel数据
  reportDepartment: async (data) => {
    return await request.post({ url: '/base/device-base/reportDepartment', data })
  },
  //下载错误报告
  downloadWrongReport: async (data) => {
    return await request.download1({ url: '/base/device-base/downloadWrongReport', data })
  },

}
